<?php
$ArPaymentReports = Dracosys::getSessionValue(SESSION_INTERFACE, 'PaymentReport');
?>
<h2>Relatório Clientes Inadimplentes</h2>
<section id="PaymentReport">
    <table id="PaymentReport_ReportTempo" class="Report">
        <thead>
            <tr>
                <th colspan="7">Tempo de Empresa</th>
            </tr>
            <tr class="header">
                <td>Cliente</td>
                <td>Email</td>
                <td>Dias</td>
            </tr>
        </thead>
        <tbody>
            <?php foreach((array) $ArPaymentReports['TEMPO'] as $Customer): ?>
                <tr>
                    <td><?=$Customer->getCustomerName()?></td>
                    <td><?=$Customer->getArGeneralData('StEmail')?></td>
                    <td><?=$Customer->daysSinceRegister()?> dias</td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    <table id="PaymentReport_ReportInvestido" class="Report hide">
        <thead>
            <tr>
                <th colspan="7">Mais Dinheiro Investido</th>
            </tr>
            <tr class="header">
                <td>Cliente</td>
                <td>Email</td>
                <td>Valor</td>
            </tr>
        </thead>
        <tbody>
            <?php foreach($ArPaymentReports['VALOR'] as $Customer): ?>
                <tr>
                    <td><?=$Customer->getCustomerName()?></td>
                    <td><?=$Customer->getArGeneralData('StEmail')?></td>
                    <td><?=$Customer->getReport('Total')?></td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    <table id="PaymentReport_ReportPontual" class="Report hide">
        <thead>
            <tr>
                <th colspan="7">Clientes que nunca atrasaram mensalidade</th>
            </tr>
            <tr class="header">
                <td>Cliente</td>
                <td>Email</td>
                <td>Numero de Mensalidades</td>
                <td>Tempo de Casa</td>
            </tr>
        </thead>
        <tbody>
            <?php foreach($ArPaymentReports['PONTUAL'] as $Customer): ?>
                <tr>
                    <td><?=$Customer->getCustomerName()?></td>
                    <td><?=$Customer->getArGeneralData('StEmail')?></td>
                    <td><?=$Customer->countReleasesPayments()?></td>
                    <td><?=$Customer->daysSinceRegister()?> dias</td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>

    <div class="pagination">
        <a href="#" rel="ReportTempo" class="selected borderRadios">Tempo de Empresa</a>
        <a href="#" rel="ReportInvestido" class="nonselected borderRadios">Mais Dinheiro Investido</a>
        <a href="#" rel="ReportPontual" class="nonselected borderRadios">Clientes Que Nunca Atrasaram</a>
    </div>
</section>
